require(['init'], function () {
//点击添加

function bindSubmit(){
  $("#submit_html").on('click',function(){
    if(FormCheck.childrenInputCheck($('#content_maketing'))){
      var id=$('input[name="id"]').val();
      var name=$('input[name="name"]').val();
      var number=$('input[name="number"]').val();
      var staff=$('input[name="staff"]').val();
      var ClassInNo=$('input[name="ClassInNo"]').val();
      var source=$('#source').find("option:selected").attr("data-uid");
      var arr={
          name:name,
          number:number,
        }
      if (editFlag) {
        // ajaxMethod({
        //     url: '/api/marketing/lead/'+id,
        //     type: 'put',
        //     data: arr,
        //     success: function (data) {
        //         //alert("编辑")
        //       location.replace("potential_guest_list.html");
        //
        //     }
        // });
      }else{
        ajaxMethod({
            url: '/api/marketing/contact',
            type: 'post',
            data: arr,
            success: function (data) {
                alert("添加")
              //location.replace("potential_guest_list.html");

            }
        });
      }
    }
  })
}

var id = location.search.urlToObj().id;
var sourcetext = location.search.urlToObj().sourcetext;
    var editFlag = false
    if (id) {
        editFlag = true
        loadEnrollData(id, bindSubmit)
        return
    }
    bindSubmit()


})
